package cn.lanqiao.blog.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.lanqiao.blog.dao.ArticleMapper;
import cn.lanqiao.blog.dao.CheckMapper;
import cn.lanqiao.blog.entity.Check;
import cn.lanqiao.blog.service.CheckService;

@Component
public class CheckServiceImpl implements CheckService{
	
	@Autowired
	private CheckMapper checkMapper;
	@Autowired
	private ArticleMapper articleMapper;

	@Override
	public int updateCheck(Check record) {
		// TODO Auto-generated method stub
		int a = checkMapper.update(record);
		if(record.getIsCheck()==0) {
			articleMapper.pass(articleMapper.getAll());
		}
		return a;
	}

	@Override
	public Check getAll() {
		// TODO Auto-generated method stub
		return checkMapper.selectAll();
	}
	
	
}